package com.a1113;

public class a02 {
//测试
    public static void main(String[] args) {
        TestFunction1 testFunction = new TestFunction1();
        int num = testFunction.printNum();
        System.out.println(num);
    }
}




//27 编写类TestFunction,成员方法有printNum,方法的功能是:打印出1-100之间的奇数和,返回累加的结果.

class TestFunction1{
    public int printNum(){

        int sum = 0;
        for(int i=0;i<=100;i++){
            if(i%2 != 0){
                sum += i;
            }

        }
         return sum;

    }

}
